package com.leetcode.weekly.contest.no282th;

/**
 * @author 覃国强
 * @date 2022-02-27 10:30
 */
public class A01_统计包含给定前缀的字符串 {

  static
  class Solution {
    public int prefixCount(String[] words, String pref) {
      if (words == null || words.length == 0 || pref == null || pref.length() == 0) {
        return 0;
      }

      int answer = 0;
      for (String word : words) {
        if (word.startsWith(pref)) {
          ++answer;
        }
      }

      return answer;
    }
  }

}
